package com.cy;
//懒汉式 单例模式 设计
public class Test18 {
    public static void main(String[] args) {

        Student2 a = Student2.get();
        Student2 b = Student2.get();
        System.out.println(a==b);
    }
}
class Student2{
    private Student2(){}

  static   private Student2 s;

   synchronized static  public Student2 get(){
       if(s==null){
           s=new Student2();
       }
        return s;
    }
}